import pandas as pd
import os

print(os.getcwd())

# 只读模式打开./data/2.xlsx文件
df = pd.read_excel('./data/2.xlsx')

# Calculate the number of rows for each split file
rows_per_file = len(df) // 10

# Loop through each file
for i in range(10):
    # Calculate the start and end index for each split
    start = i * rows_per_file
    end = (i + 1) * rows_per_file if i < 9 else None

    # Split the dataframe
    df_part = df[start:end]

    # Save the part to a new file
    df_part.to_excel(f'part_{i+1}.xlsx', index=False)
